package com.swkl.yuan.agvtask.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.swkl.yuan.agvtask.dao.SystemConfigDao;
import com.swkl.yuan.agvtask.entity.AgvConfig;
import com.swkl.yuan.agvtask.entity.SystemConfig;
import com.swkl.yuan.agvtask.service.AgvConfigService;
import com.swkl.yuan.agvtask.service.SystemConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 其他配置项(SystemConfig)表服务实现类
 *
 * @author makejava
 * @since 2024-06-19 16:41:11
 */
@Service("systemConfigService")
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, SystemConfig> implements SystemConfigService {




    @Override
    public SystemConfig getSystemConfig() {
        return getById(900001);
    }

    @Override
    public Boolean modifySystemConfig(SystemConfig systemConfig) {
        return updateById(systemConfig);
    }


    @Override
    public Boolean modifySystemConfig(String ip,String dbAddress,String plcType,String heartbeatOffset,String errorOffset,String requestMoveApi,String requestFinishApi) {
        SystemConfig systemConfig = new SystemConfig();
        systemConfig.setId(900001L).setIp(ip).setDbAddress(dbAddress).setPlcType(plcType).setHeartbeatOffset(heartbeatOffset).setErrorOffset(errorOffset);
        AgvConfig agvConfig = new AgvConfig().setId(900001L).setRequestMoveApi(requestMoveApi).setRequestFinishApi(requestFinishApi);
        return updateById(systemConfig)&& agvConfig.updateById();
    }
}

